<?php

namespace app\model;

use think\Model;

class Job extends Model
{
    public static function getJobs($query, $status = 1, $isdelete = 0)
    {
        if (isset($query['job'])) {
            return self:: where('status', $status)
                ->where('isdelete', $isdelete)
                ->whereLike('name', '%' . $query['job'] . '%')
                ->paginate(5, false, [
                    'query' => $query,
                    'type' => 'custom'
                ]);
        } else {
            return self:: where('status', $status)
                ->where('isdelete', $isdelete)
                ->paginate(5, false, [
                    'query' => $query,
                    'type' => 'custom'
                ]);
        }
    }

    public function getCreateTimeAttr($value)
    {
        return intval($value);
    }
}
